{# 以下是分页  #}
<div>
    <nav aria-label="Page navigation">
        <ul class="pagination">
            <li class="disabled">
                <span>每页显示</span>
            </li>
            <li>
                            <span>
                                <select class="line_count" id="page_set" line_count= {{  line_count }}  name="line_count">
                                    <option>5</option>
                                    <option>10</option>
                                    <option>15</option>
                                    <option>20</option>
                                </select>
                            </span>
            </li>
            <li >
                {#<span aria-hidden="true"><input type="button" onclick="aa_line()" class="line_count_a" value="确定"></span>#}
                <span onclick="aa_line()" class="line_count_a" style="cursor:pointer;" >确定</span>
            </li>

            <li>
                <a href="{{ request.path }}?page=1&line_count={{ line_count  }}&user_search={{ search }}" aria-label="Previous">
                    <span aria-hidden="true">第一页</span>
                </a>
            </li>

            {% if current_page.has_previous %}
                <li>
                    <a href="{{ request.path }}?page={{ current_page.previous_page_number }}&line_count={{ line_count  }}&user_search={{ search }}" aria-label="Previous">
                        <span aria-hidden="true">上一页</span>
                    </a>
                </li>
            {% else %}
                <li class="disabled">
                    <a href="" aria-label="Previous">
                        <span aria-hidden="true">上一页</span>
                    </a>
                </li>
            {% endif %}
            {# 拿到页码书总列表 #}
            {% for item in  page_range %}
                {% if current_page_num == item %}
                    <li class="active"><a href="{{ request.path }}?page={{ item }}&line_count={{ line_count  }}&user_search={{ search }}">{{ item }}</a></li>
                {% else %}
                    <li ><a href="{{ request.path }}?page={{ item }}&line_count={{ line_count  }}&user_search={{ search }}">{{ item }}</a></li>
                {% endif %}
            {% endfor %}

            {% if current_page.has_next %}
                <li>
                    <a href="{{ request.path }}?page={{ current_page.next_page_number }}&line_count={{ line_count  }}&user_search={{ search }}" aria-label="Next">
                        <span aria-hidden="true">下一页</span>
                    </a>
                </li>
            {% else %}
                <li class="disabled">
                    <a href="" aria-label="Previous">
                        <span aria-hidden="true">下一页</span>
                    </a>
                </li>
            {% endif %}
            <li>
                <a href="{{ request.path }}?page={{ last_page }}&line_count={{ line_count  }}&user_search={{ search }}" aria-label="Previous">
                    <span aria-hidden="true">最后一页</span>
                </a>
            </li>
            <li class="disabled">
                <a href="" aria-label="Previous">
                    <span aria-hidden="true">共 {{ paginator.num_pages }} 页 , {{ paginator.count }} 条 </span>
                </a>
            </li>
        </ul>
    </nav>
</div>
{#  以上是分页 #}
{% block script %}
    <script>
        {#function aa_line(){#}
        {#    var line_count_set = $('.line_count').val();#}
        {#    var search = $('.aa_search').val();#}
        {#var   url="/oratk_app/oratk_tool_info?line_count="+line_count_set+"&user_search="+search;#}
        {#    var   url=window.location.pathname+"?line_count="+line_count_set+"&user_search="+search;#}
        {##}
        {#    window.location.href=url}#}
        document.getElementById("page_set").change(function() {
            var line_count_set = $('.line_count').val();
            var search = $('.aa_search').val();
            var   url=window.location.pathname+"?line_count="+line_count_set+"&user_search="+search;
            window.location.href=url;
        })

        //以下为页面刷新时自加载函数
        window.onload=function() {
            //刷新时,自动加载当前每页显示的条目数
            var count_set = document.getElementById("line_count").getAttribute("line_count");
            document.getElementById("line_count").value = count_set
        }

    </script>
{% endblock %}
